package com.jp.knowledge.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.jp.knowledge.R;
import com.jp.knowledge.model.ProdcutData;
import com.jp.knowledge.util.ImageLoadUtil;

import java.util.List;

/**
 * Created by jiayen on 17/6/9.
 */

public class ProductAdpater extends  JpBaseRecyViewAdapter {
    public ProductAdpater(Context context, List data) {
        super(context, data);
    }
    @Override
    public int getLayoutId() {
        return R.layout.product_fragment_item;
    }

    @Override
    public void bindViewHold(JPRecycleViewHolder holder, int position) {
        ProdcutData  data = (ProdcutData) getItem(position);
        TextView  content = holder.getView(R.id.content);
        TextView description = holder.getView(R.id.descritption);
        ImageView icon = holder.getView(R.id.icon);
        content.setText(data.getSource());
        description.setText(data.getTitle());
        ImageLoadUtil.loadrund(mContext,data.getIcon(),icon,5);
    }
}
